//
//  BlueArrowView.m
//  SNS
//
//  Created by Bobo on 11-12-12.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "BlueArrowView.h"

@implementation BlueArrowView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:0.5f];
        [UIView setAnimationRepeatCount:20];
        [UIView setAnimationRepeatAutoreverses:YES];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(remove)];
        
        self.alpha = 0.0f;
        
        [UIView commitAnimations];
    }
    return self;
}


// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextMoveToPoint(context, 0, 0);
    CGContextAddLineToPoint(context, 10, 0);
    CGContextAddLineToPoint(context, 5, 10);
    CGContextAddLineToPoint(context, 0, 0);
    
    CGContextSetFillColorWithColor(context, [UIColor colorWithRed:0 
                                                            green:195.0f/255.0f
                                                             blue:251.0f/255.0f
                                                            alpha:1].CGColor);
    CGContextFillPath(context);
}

- (void)remove {
    [self removeFromSuperview];
}

@end
